for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
const f = require('./index');
test('check referrer', () => {
let d = getTestDocument();
d.referrer = 'google';
const lastClick = f(d);
lastClick.check();
expect(lastClick.getLastClick()).toBe('google');
});
test('check location', () => {
d.location.search = '?utm_source=example.com';
expect(lastClick.getLastClick()).toBe('example.com');
function getTestDocument() {
return {
referrer: '',
location: {
search: ''
}
};